#ifndef TG_DOCUMENT_H
#define TG_DOCUMENT_H

#include <QGraphicsScene>
#include <QPrinter>

class TgPage;
class TgPageSettings;
class TgDocumentView;
class QGraphicsDropShadowEffect;

class TgDocument : public QGraphicsScene
{
    Q_OBJECT
    Q_PROPERTY(int dpi READ dpi WRITE setDpi USER true SCRIPTABLE true STORED true)
    typedef QGraphicsScene BaseClass;

public:

    static const int defaultDpi = 300;
    static const int minimumDpi = 72;
    static const int maximumDpi = 3200;

    explicit TgDocument(QObject *parent = 0);
    virtual ~TgDocument();

    TgPageSettings* createPageSettings();

    TgPage* createPage();
    TgPage* createPage(TgPageSettings* settings);

    TgPageSettings* currentPageSettings() const;

    void setPageOrientation(QPrinter::Orientation orientation);

    inline TgDocumentView* view() const;

    inline QGraphicsDropShadowEffect* pageShadowEffect() const;

    inline int dpi() const;
    void setDpi(int dpi);

    void clear();

signals:
    void dpiChanged(TgDocument* thisDocument, int dpi);

protected:
    TgDocumentView* m_view;
    QList<TgPage*> m_pages;
    QList<TgPageSettings*> m_pageSettings;
    QGraphicsDropShadowEffect* m_pageShadow;
    int m_dpi;
};

////////////////////////////////////////////////////

QGraphicsDropShadowEffect* TgDocument::pageShadowEffect() const
{
    return m_pageShadow;
}

int TgDocument::dpi() const
{
    return m_dpi;
}

#endif // TG_DOCUMENT_H
